/*
 * Package il.ac.biu.cs.grossmm.api.data
 * File NodeConversion.java
 * 
 * This is a part of presence service framework API. 
 * See javadoc for more information.
 *  
 * Copyright (C) 2006 Grossmann Mark
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package il.ac.biu.cs.grossmm.api.flow;

import il.ac.biu.cs.grossmm.api.OperationFailedException;
import il.ac.biu.cs.grossmm.api.data.NodeType;
import il.ac.biu.cs.grossmm.api.data.Root;

/**
 * <p>
 * Converts streams of notifications about change for data nodes of a source
 * node type to a stream of notifications about data change for data nodes of a
 * destination node type.
 * <p>
 * A <tt>ConverterProxy</tt> object is returned for each stream of
 * notifications, this object is used to convert event notifications in this
 * stream.
 * 
 * @see ConverterProxy
 */
public interface Converter<Nsrc, Ndst> {
	/**
	 * Gets the source data node type
	 * 
	 * @return the source data node type
	 */
	NodeType<Nsrc> getSourceType();

	/**
	 * Gets the destination data node type
	 * 
	 * @return the destination data node type
	 */
	NodeType<Ndst> getDestinationType();

	/**
	 * Gets the priority of this converter in range (0.0, 1.0]
	 * 
	 * @return the priority of this converter in range (0.0, 1.0]
	 */
	double getPriority();

	/**
	 * Returns a converter proxy for a notification stream
	 * 
	 * @param srcNode
	 *            the source node to convert in this stream
	 * @param dstNode
	 *            the destination node to convert in this stream
	 * @param srcInspector
	 *            node inspector for the source node
	 * @param dstManipulator
	 *            node manipulator for the destination node
	 * @return converter proxy for a notification stream
	 * @throws OperationFailedException
	 */
	ConverterProxy<Nsrc, Ndst> createProxy(Root<Nsrc> srcNode,
		Root<Ndst> dstNode, NodeInspector srcInspector,
		NodeManipulator dstManipulator) throws OperationFailedException;
}
